<!DOCTYPE html>
<html lang="zh"  xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />
    <title>SSM整合考试</title>
    <link rel="icon" href="/imgs/favicon.ico" type="image/ico">
    <meta name="author" content="yinqi">
    <link th:href="@{/css/bootstrap.min.css}" rel="stylesheet">
    <link th:href="@{/css/materialdesignicons.min.css}" rel="stylesheet">
    <link th:href="@{/css/style.min.css}" rel="stylesheet">
    <link th:href="@{/js/jquery.min.js}" rel="stylesheet">
</head>
<body>
    <div class="row">
        <div class="col-md-12">
            <ol class="breadcrumb">
                <li><a href="#">系统管理</a></li>
                <li><a href="#">用户管理</a></li>
                <li><a href="#">用户列表</a></li>
              </ol>
        </div>
    </div>
    <div class="row">
        <div class="col-md-12">
            <div class="card">
                <div class="card-body">
                    <form class="form-inline" method="post" th:action="@{/user/list}">
                        <div class="form-group">
                            <label for="username">用户名&nbsp;&nbsp;</label>
                            <input type="text" class="form-control" id="username" name="username" placeholder="请输入用户名">&nbsp;&nbsp;
                        </div>
                        <button type="submit" class="btn btn-primary">搜索</button>
                        <a th:href="@{/user/detail}" target="myframe" class="btn btn-info">添加</a>
                    </form>

                    <hr>
                    <div class="table-responsive">
                        <table class="table table-bordered">
                          <thead>
                            <tr>
                              <th>编号</th>
                              <th>用户名</th>
                              <th>姓名</th>
                              <th>操作</th>
                            </tr>
                          </thead>
                          <tbody>
                          <tr th:each="user,state:${userList}">

                              <td><span th:text="${user.id}"></span></td>
                              <td><span th:text="${user.username}"></span></td>
                              <td><span th:text="${user.truename}"></span></td>

                              <td>
                                  <div class="btn-group">
                                      <a class="btn btn-xs btn-default" th:href="@{/user/detail(id=${user.id})}" target="myframe" title="编辑" data-toggle="tooltip">编辑</a>
                                      <a class="btn btn-xs btn-default" th:href="@{/user/delete(id=${user.id})}" title="删除" data-toggle="tooltip">删除</a>
                                      <!--<button type="button" th:onclick="edit()" class="btn btn-default" data-toggle="modal"><span class="glyphicon glyphicon-pencil"></span>编辑</button>
                                      <button type="button" onclick="deleteBtn()" class="btn btn-default" data-toggle="modal"><span class="glyphicon glyphicon-pencil"></span>删除</button>-->
                                  </div>
                              </td>
                          </tr>

                          </tbody>
                        </table>
                      </div>


                </div>
            </div>
        </div>
    </div>
</body>
<script >
    function edit(){
        var id = document.getElementById("hao").innerHTML;
        location.href = '[[@{/user/detail}]]'+"?id="+id;
    }
    function deleteBtn(){
        location.href = '[[@{/user/delete}]]'+"?id="+id;
    }
</script>
</html>